﻿// DesignPattern.cpp: 定义应用程序的入口点。
//

#include "main.h"
#include "BorderDecorator.h"
#include "ShadowDecorator.h"
#include "TextView.h"
#include "ImageView.h"

using namespace std;

int main()
{
	auto text = std::shared_ptr<IView>(new TextView());
	auto image = std::shared_ptr<IView>(new ImageView());
	auto border1 = BorderDecorator(text);
	auto border2 = std::shared_ptr<IView>(new BorderDecorator(image));
	auto shadow1 = ShadowDecorator(text);
	auto shadow2 = ShadowDecorator(border2); // 装饰器之间可以嵌套使用

	text->Draw();
	std::cout << endl;

	image->Draw();
	std::cout << endl;

	border1.Draw();
	std::cout << endl;

	border2->Draw();
	std::cout << endl;

	shadow1.Draw();
	std::cout << endl;

	shadow2.Draw();
	std::cout << endl;

	return 0;
}
